﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.TcCommands.TcCheckoutCheckin.CCoTcCheckinCmd
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using EngineeringInternalExtension;
using System;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.PrivateImplementationDetails;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands.TcCommands.TcCheckoutCheckin;

public class CCoTcCheckinCmd : CCoTcCheckoutCheckinBaseCmd
{
  public CCoTcCheckinCmd() => this._enabler = new CApTcCheckoutCheckinEnabler();

  protected override void ExecuteSpecificCommand(object cmdParams)
  {
    TxObjectList txObjectList = !(cmdParams is TxObjectList) ? TxApplication.ActiveSelection.GetItems() : cmdParams as TxObjectList;
    Cursor current = Cursor.Current;
    try
    {
      Cursor.Current = Cursors.WaitCursor;
      TxErrorStack.Clear();
      TxTcUtilities.CheckIn((ITxTcGlobalServicesProvider) (TxApplication.ActiveDocument.PlatformGlobalServicesProvider as TxTcGlobalServicesProvider), txObjectList, true);
      if (cmdParams == null)
      {
        TxObjectList items = TxApplication.ActiveSelection.GetItems();
        TxApplication.ActiveSelection.Clear();
        TxApplication.ActiveSelection.SetItems(items);
      }
      Cursor.Current = current;
      this.ShowExecutionResult();
    }
    catch (Exception ex)
    {
      Cursor.Current = current;
      int num = (int) TxMessageBox.ShowModal(ex.Message, base.Name, MessageBoxButtons.OK, MessageBoxIcon.Hand);
    }
  }

  public virtual string Name => StringTable.TC_CHECKIN_CMD_NAME;

  public virtual string Bitmap => "TcCommands.TcCheckoutCheckin.Images.CheckInInPSonTc.bmp";

  public virtual string LargeBitmap => "TcCommands.TcCheckoutCheckin.Images.CheckInInPSonTc.png";

  public virtual ITxImage Image => (ITxImage) TxImageManager.GetImageByKey("CheckInTc");

  public virtual string Tooltip => StringTable.TC_CHECKIN_CMD_TOOLTIP;

  public virtual string Description => StringTable.TC_CHECKIN_CMD_DESCRIPTION;

  protected override string ErrWindowSubTitle => StringTable.TC_CHECKIN_FAILED_SUBTITLE;

  protected override string ErrWindowInnerTitle => StringTable.TC_CHECKIN_FAILED_OBJECTS;
}
